package solution.tree;

import com.alibaba.fastjson.JSONObject;

public class TreeTest {
    public static void main(String[] args) {
        TreeNode root = new TreeNode(0,"root");
        TreeNode node1 = new TreeNode(1, "node1");
        TreeNode node2 = new TreeNode(2, "node2");
        TreeNode node3 = new TreeNode(3, "node3");
        TreeNode node4 = new TreeNode(4, "node4");

        TreeOps treeOps = new TreeOps();
        root.left = node1;
        root.right = node2;
        root.left.left = node3;
        root.left.right = node4;
        treeOps.setRoot(root);
        //treeOps.preOrder();
        //TreeNode byPre = treeOps.findByMiddle(4);

        // 反转二叉树
        //TreeNode transfer = treeOps.transfer();
        //System.out.println(JSONObject.toJSON(transfer));

        treeOps.print();
    }
}
